import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
//import { PreloadAllModules } from '@angular/router';
import { SelectivePreloadingStrategyService } from '@core/services/common/selective-preloading-strategy.service';


const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: '/login' },
  { path: 'home', data: { title: 'home' }, loadChildren: () => import('./pages/home/home.module').then(m => m.HomeModule) },
  { path: 'main', data: { title: 'main', preload: true }, loadChildren: () => import('./layout/main/main.module').then(m => m.MainModule) },
  { path: 'login', data: { title: 'login', preload: true }, loadChildren: () => import('./pages/login/login.module').then(m => m.LoginModule) },
  { path: '404', data: { title: 'page-not-found', preload: true }, loadChildren: () => import('./pages/page-not-found/page-not-found.module').then(m => m.PageNotFoundModule) }
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      relativeLinkResolution: 'legacy',
      preloadingStrategy: SelectivePreloadingStrategyService,
      //preloadingStrategy: PreloadAllModules,
      scrollPositionRestoration: 'top',
      //initialNavigation: 'enabledBlocking',
      //useHash: true
    })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }
